package com.xjy.ftpmanagment.service;

import com.xjy.common.service.BaseService;
import com.xjy.common.util.EncryptionUtil;
import com.xjy.ftpmanagment.dao.SysUserDao;
import com.xjy.ftpmanagment.pojo.SysUser;

public class LoginService extends BaseService {
	private SysUserDao sysUserDao;

	public SysUserDao getSysUserDao() {
		return sysUserDao;
	}

	public void setSysUserDao(SysUserDao sysUserDao) {
		this.sysUserDao = sysUserDao;
	}
	public boolean findUser(String username,String password){
		//test
		//save();
		return this.sysUserDao.exists(" username=? and (password=? or password=?)", new Object[]{username,password,EncryptionUtil.getMD5(password)});
	}
	public void save(){
		try{
			SysUser sysUser=SysUser.create();
			sysUser.setUsername("dsdsd");
			sysUser.setPassword("sfsdf");
			this.sysUserDao.save(sysUser);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}
}
